package dome1;
class Shape{
    public void draw(){
        System.out.println("画一个图形");
    }
}
class  Rect extends Shape{
    @Override
    public void draw() {
        System.out.println("画矩形");
    }
}
class Tringle extends Shape{
    @Override
    public void draw() {
        System.out.println("画一个三角形");
    }
}
public class Test {
    public static void main(String[] args) {

        Shape[] shapes = {new Rect(),new Shape()};
            for(Shape shape:shapes){
                shape.draw();
            }
    }

}
